package ui.provider;

import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import ui.tempdao.EgnMarketVariDao;



public class MarketVariableContent implements ITreeContentProvider{
	private final static Logger logger = LoggerFactory.getLogger(MarketVariableContent.class);

	@Override
	public void dispose() {
	}
	
	@Override
	public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
//		this.marketVariable = (MarketVariable) newInput;
	}

	@Override
	public Object[] getElements(Object inputElement) {
		return EgnMarketVariDao.getEgnMarketVariTypes().toArray();
	}

	@Override
	public Object[] getChildren(Object parentElement) {
		if (parentElement instanceof String) {
			return EgnMarketVariDao.getTypedEgnMarketVari((String)parentElement).toArray();
		}
		else {
			return null;
		}
	}

	@Override
	public Object getParent(Object element) {
		return null;
	}

	@Override
	public boolean hasChildren(Object element) {
		if (element instanceof String) {
			return true;
		}
		return false;
	}

//	@Override
//	public void addListenerTo(){

//	}
}
